Hack Name: Email Notification of New Posts v1.0

Authors: WormHole & GuldantheWarlock

Original Code by: John Briggs 

Last Updated: 04/08/06

Description:
This hack will send an email notification to the Administrator email address when replies and new threads are posted.
The feature can be turned on or off via the Admin Panel.

Supported Version: XMB 1.9.5 Nexus Final and XMB 1.9.6 SP1 (or 1.9.6 Alpha). Do Not Use On Any Other Version Of XMB.

Notes:

This hack is released under the GPL. You should have recieved a copy of it with this hack.

Please backup your files before installing this mod. Neither XMBGarage nor the author can be held 
responsible if your board stops functioning properly due to you installing this hack.

=======================================================================================================

=======
Step 1:
=======

===================================
Go To Admin Panel -> Insert Raw SQL
===================================

========================================
Paste the following code and hit submit:
========================================

ALTER TABLE `$table_settings` ADD `postemailcheck` varchar(3) NOT NULL default 'on';

=======================================================================================================

=======
Step 2:
=======

=================================
Edit File: lang/English.lang.php:
=================================

=================
Add To End Of File:
=================

// Email Notification of New Posts Mod Begin
$lang['postnotifystatus'] = "Notify Admin Of All Posts:";
$lang['postnotifysubject'] = "$username has replied to ";
$lang['postnotifymcode'] = '$lang["postnotifymessage"] = "$username has posted a new reply to: $threadname\n\n$username posted:\n\nSubject: $subject\n$message\n\n$threadurl";';
$lang['postnotifynsubject'] = "New Thread at $bbname";
$lang['postnotifyntmcode'] = '$lang["postnotifyntmessage"] = "$username has posted a new thread - $subject\n\n$message\n\n$threadurl";';
// Email Notification of New Posts Mod End

=======================================================================================================

=======
Step 3:
=======

==================
Edit File: cp.php:
==================

=====
Find:
=====

        $echeckon = $echeckoff = '';
        if ($SETTINGS['emailcheck'] == "on") {
            $echeckon = $selHTML;
        } else {
            $echeckoff = $selHTML;
        }
        
==========
Add Below:
==========
        
        // Email Notification of New Posts Mod Begin
        $postemailcheckon = $postemailcheckoff = '';
        if ($SETTINGS['postemailcheck'] == "on") {
            $postemailcheckon = $selHTML;
        } else {
            $postemailcheckoff = $selHTML;
        }
        // Email Notification of New Posts Mod End
        
=====
Find:
=====

        printsetting1($lang['doublee'], 'doubleenew', $doubleeon, $doubleeoff);
        
==========
Add Below:
==========

        // Email Notification of New Posts Mod Begin
        printsetting1($lang['postnotifystatus'], 'postemailchecknew', $postemailcheckon, $postemailcheckoff);
        // Email Notification of New Posts Mod End

=====
Find:
=====

        $resetSigNew = ($resetSigNew == 'on') ? 'on' : 'off';

==========
Add Below:
==========

        // Email Notification of New Posts Mod Begin
        $postemailchecknew == ($postemailchecknew == 'on') ? 'on' : 'off';
        // Email Notification of New Posts Mod End
        
=====
Find:
=====

        $db->query("UPDATE $table_settings SET
        
===============================
Add to End of Line BEFORE "); :
===============================

, postemailcheck='$postemailchecknew'

=======================================================================================================

=======
Step 4:
=======

====================
Edit File: post.php:
====================

=====
Find:
=====

        $db->query("INSERT INTO $table_posts ( fid, tid, author, message, subject, dateline, icon, usesig, useip, bbcodeoff, smileyoff ) VALUES ('$fid', '$tid', '$username', '$message', '$subject', ".$db->time($thatime).", '$posticon', '$usesig', '$onlineip', '$bbcodeoff', '$smileyoff')");
        $pid = $db->insert_id();
            
==========
Add Above:
==========

        // Email Notification on New Posts Begin
        if ($SETTINGS['postemailcheck'] == "on") {
            $message = stripslashes($message);
            $threadurl = $boardurl."viewthread.php?tid=$tid";
            $subject = (phpversion() < 5) ? html_entity_decode(stripslashes($subject), ENT_QUOTES) : htmlspecialchars_decode(stripslashes($subject), ENT_QUOTES);
            eval($lang['postnotifyntmcode']);
            altMail($adminemail, $lang['postnotifynsubject'], $lang['postnotifyntmessage'], "From: $bbname <$adminemail>");
        }   
        // Email Notification on New Posts End

=====================
Find (2nd Occurance):
=====================

            $db->query("INSERT INTO $table_posts ( fid, tid, author, message, subject, dateline, icon, usesig, useip, bbcodeoff, smileyoff ) VALUES ('$fid', '$tid', '$username', '$message', '$subject', ".$db->time(time()).", '$posticon', '$usesig', '$onlineip', '$bbcodeoff', '$smileyoff')");
            $pid = $db->insert_id();

==========
Add Below:
==========

            // Email Notification on New Posts Begin
            if ($SETTINGS['postemailcheck'] == "on") {
                $message = stripslashes($message);
                $threadurl = $boardurl."viewthread.php?tid=$tid";
                $subject    = (phpversion() < 5) ? html_entity_decode(stripslashes($subject), ENT_QUOTES) : htmlspecialchars_decode(stripslashes($subject), ENT_QUOTES);
                $threadname = (phpversion() < 5) ? html_entity_decode(stripslashes($thread['subject']), ENT_QUOTES) : htmlspecialchars_decode(stripslashes($thread['subject']), ENT_QUOTES);
                eval($lang['postnotifymcode']);
                altMail($adminemail, $lang['postnotifysubject'].$threadname, $lang['postnotifymessage'], "From: $bbname <$adminemail>");
            }
            // Email Notification on New Posts End
        
=======================================================================================================

Upload all Edited files and Enjoy!